package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.vo.AirdropGrantEquityPropsRecordVO;
import com.sc.nft.entity.vo.AirdropGrantRecordExportListVO;
import com.sc.nft.entity.vo.AirdropGrantRecordVO;
import com.sc.nft.enums.EquityPropsTypeEnum;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.AirdropGrantRecord;
import com.sc.nft.mapper.AirdropGrantRecordMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * (sc_airdrop_grant_record)数据DAO
 *
 * @author rdg
 * @since 2022-06-09 17:05:25
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class AirdropGrantRecordDao extends ServiceImpl<AirdropGrantRecordMapper, AirdropGrantRecord> {

    public Page<AirdropGrantRecordVO> airdropGrantRecordList(int pageNo, int pageSize, String nickName, String userTel, String userUuid, String productUuid, String firstTitle, Integer typeClassify) {
        return baseMapper.airdropGrantRecordList(new Page<>(pageNo,pageSize),nickName,userTel,userUuid,productUuid,firstTitle,typeClassify);
    }
    public List<AirdropGrantRecordExportListVO> airdropGrantRecordListExport(String collectionName, Date startTime, Date endTime) {
        return baseMapper.airdropGrantRecordListExport(collectionName, startTime, endTime);
    }

    public Integer getCountByUserId(Long id) {
        LambdaQueryWrapper<AirdropGrantRecord>wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(AirdropGrantRecord::getUserId,id);
        return count(wrapper);
    }

    public Integer getYesterDayCountByCollectionId(Long cityLordCollectionId) {
        return baseMapper.getYesterDayCountByCollectionId(cityLordCollectionId);
    }

    public Integer getYesterDayCountByCollectionIdByDay(Long cityLordCollectionId,String day) {
        return baseMapper.getYesterDayCountByCollectionIdByDay(cityLordCollectionId,day);
    }

    public Integer getAllCountByCollectionId(List<Long> collectionId) {
        return baseMapper.getAllCountByCollectionId(collectionId);
    }

    public Page<AirdropGrantEquityPropsRecordVO> airdropGrantEquityPropsRecordList(Page page, String nickName, String userTel, String firstTitle, Integer typeClassify) {
        return baseMapper.airdropGrantEquityPropsRecordList(page,nickName,userTel,firstTitle,typeClassify);
    }

    public Integer getCountByCollectionId(Long collectionId) {
        return baseMapper.getCountByCollectionId(collectionId);
    }

    public Integer getAirdropFrequencyById(Long collectionId) {
        return baseMapper.getAirdropFrequencyById(collectionId);
    }
}